<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function countDown(time){
            var nowdate = +new Date();
            var inputtime = +new Date(time);
            var times = (inputtime - nowdate) / 1000;//获得当前时间差总秒数
            var d = parseInt(times / 60 / 60 /24);//天
            d = d < 10 ? "0"+d : d;
            var h = parseInt(times / 60 / 60 %24);//时
            h = h < 10 ? "0"+h : h;
            var m = parseInt(times / 60 % 60);//分
            m = m < 10 ? "0"+m : m;
            var s = parseInt(times % 60);//秒
            s = s < 10 ? "0"+s : s;
            return d+":"+h+":"+m+":"+s;
        }
        console.log(countDown('2020-9-27 21:00:00'));
        var date = new Date();
        console.log(date);
    </script>
</body>
</html>